home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2259 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  809 b 

  1. Path: atglab.bls.com!Alun.Champion
  2. From: Alun.Champion@bridge.bst.bls.com (Alun Champion)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: overloading []
  5. Date: 16 Jan 1996 19:39:55 GMT
  6. Organization: Computer People Inc.
  7. Message-ID: <ALUN.CHAMPION.96Jan16143955@g7240065.bridge.bst.bls.com>
  8. References: <4dgjbl$6i3@news1.goodnet.com>
  9. NNTP-Posting-Host: bstfirewall.bst.bls.com
  10. In-reply-to: geoff@goodguy's message of 16 Jan 1996 16:22:13 GMT
  11.  
  12. In article <4dgjbl$6i3@news1.goodnet.com> geoff@goodguy (GEOFF CADIEN) writes:
  13. : [snip]
  14. : my problem is this. Given,
  15.  
  16. : foo *f;
  17.  
  18. : f = new foo;
  19.  
  20. : Now the only way I can use the subscript operator is to call it like this
  21.  
  22. : f->operator[](1) = 10;
  23.  
  24. : Is this the only way?
  25.  
  26. No:
  27.  
  28.   (*f)[1] = 10;
  29.  
  30. or
  31.  
  32.   foo& a = *f;
  33.   a[1] = 10;
  34.  
  35. Regards
  36.  
  37.   -A.
  38. -- 
  39. | A.Champion                |
  40.